$(function(){
    var submit=document.getElementById("submit");
    submit.onclick=function(){
         $.ajax({
            url:"http://localhost/server/register.php",
            data:{
                username:$("#username").val(),
                password:$("#password").val(),
            },
            dataType:"json",
            type:"POST"
             
    }).done(function(res)
    {
        console.log(res);
        // var data = JSON.parse(res);
        if (res.type === "success") {
          location.href = "../singin.html";
        } 
    })
   
}
})